import request from '@/utils/request'
import {encodeParams} from '@/utils'

//课程类型树形列表
export function getList(data) {
  return request({
    url: '/api/course/type/treeList',
    method: 'POST',
    data
  })
}

//创建
export function create(data) {
  return request({
    url: '/api/course/type/create',
    method: 'POST',
    data
  })
}

//根据id删除
export function deleteById(id) {
  return request({
    url: `/api/course/type/delete/${id}`,
    method: 'GET',
  })
}

//根据id查询
export function getById(id) {
  return request({
    url: `/api/course/type/get/${id}`,
    method: 'GET',
  })
}
//根据id查询
export function getByParentId(parentId) {
  return request({
    url: `/api/course/type/getByParentId/${parentId}`,
    method: 'GET',
  })
}

//更新
export function update(data) {
  return request({
    url: '/api/course/type/update',
    method: 'POST',
    data
  })
}

export default {
  getList, update, getById, create, deleteById,getByParentId
}
